package com.vogue.supplymall.order.domain.mapper;

import com.vogue.ssm.database.util.SqlLangDriver;
import com.vogue.supplymall.common.domain.dto.RefundMaxCountInfo;
import com.vogue.supplymall.order.domain.model.RefundDetail;
import com.vogue.supplymall.order.domain.provider.RefundMaxqQuantity;
import com.vogue.supplymall.order.domain.provider.RefundOrderDetailSqlProvider;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

/**
 * The type Refund detail mapper.
 *
 * @aouthor: zhangliang
 * @date: Create in 2018-03-16
 */
@Mapper
public interface RefundDetailMapper extends BaseMapper<RefundDetail, Long> {
	
	@SelectProvider(type = RefundOrderDetailSqlProvider.class, method = "findRefundOrderDetail")
    List<Map<String, Object>> findRefundOrderDetail(Long refundOrderId) throws RuntimeException;
	
	@SelectProvider(type = RefundOrderDetailSqlProvider.class, method = "findRefundOrderRefundUpload")
    List<Map<String, Object>> findRefundOrderRefundUpload(Long refundOrderId) throws RuntimeException;
	
	@SelectProvider(type=RefundMaxqQuantity.class,method="find")
	List<Map<String, Object>> findRefundMaxQuantity(RefundMaxCountInfo refundMaxCountInfo) throws RuntimeException;

	@Select("select SUM(rd.refundquantity) refundquantity from refund_detail rd where rd.oiid = #{oiid}")
	@Lang(SqlLangDriver.class)
	Integer findRefundquantitySum(Long oiid);
}
